package com.itheima.wms.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.itheima.pinda.base.entity.Entity;
import com.itheima.pinda.base.entity.SuperEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import static com.baomidou.mybatisplus.annotation.SqlCondition.EQUAL;
import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 库存记录
 * </p>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@SuperBuilder
@TableName("wms_stock_record")
@ApiModel(value = "StockRecord", description = "库存记录")
public class StockRecordEntity extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 来源id
     */
    @ApiModelProperty(value = "来源id")
    @NotNull(message = "来源id不能为空", groups = {Save.class})
    @TableField(value = "source_id")
    private Long sourceId;
    /**
     * 库位id
     */
    @ApiModelProperty(value = "库位id")
    @NotNull(message = "库位id不能为空", groups = {Save.class})
    @TableField(value = "location_id")
    private Long locationId;
    /**
     * 任务类型
     */
    @ApiModelProperty(value = "任务类型")
    @NotEmpty(message = "任务类型不能为空", groups = {Save.class})
    @Length(max = 10, message = "任务类型长度不能超过10")
    @TableField(value = "type")
    private String type;
    /**
     * 原始总库存
     */
    @ApiModelProperty(value = "原始总库存")
    @TableField(value = "original")
    private Integer original;

    @ApiModelProperty(value = "原始可用库存")
    @TableField(value = "original_free")
    private Integer originalFree;
    /**
     * 变动方式 + -
     */
    @ApiModelProperty(value = "变动方式 + -")
    @NotEmpty(message = "变动方式 + -不能为空", groups = {Save.class})
    @Length(max = 2, message = "变动方式 + -长度不能超过2")
    @TableField(value = "way")
    private String way;
    /**
     * 操作库存
     */
    @ApiModelProperty(value = "操作库存")
    @TableField(value = "alteration")
    private Integer alteration;
    /**
     * 操作后库存
     */
    @ApiModelProperty(value = "操作后总库存")
    @TableField(value = "result")
    private Integer result;

    @ApiModelProperty(value = "操作后可用库存")
    @TableField(value = "result_free")
    private Integer resultFree;
    /**
     * 状态
     */
    @ApiModelProperty(value = "状态")
    @TableField(value = "status")
    private Integer status;
    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Length(max = 255, message = "备注长度不能超过255")
    @TableField(value = "remark")
    private String remark;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @Length(max = 50, message = "创建人长度不能超过50")
    @TableField(value = "create_name", fill = FieldFill.INSERT)
    private String createName;
    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    @Length(max = 50, message = "更新人长度不能超过50")
    @TableField(value = "update_name", fill = FieldFill.INSERT_UPDATE)
    private String updateName;
    /**
     * 逻辑删除 0 删除
     */
    @ApiModelProperty(value = "逻辑删除 0 删除")
    @TableField(value = "logic_del")
    private Integer logicDel;
}
